Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 16: Binding Colors to Points, Lines, Faces, and Coordinates

../ch16/16fig03.gif
Figure 16.3

A star burst of lines colored using colors from a Color node.

16fig03.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
    children [
        DEF Burst Shape {
            # no appearance, use emissive coloring
            geometry IndexedLineSet {
                coord Coordinate {
                    point [
                         0.00  0.00  0.00,   1.00  0.00  0.00,
                         0.92  0.38  0.00,   0.71  0.71  0.00,
                         0.38  0.92  0.00,   0.00  1.00  0.00,
                        -0.38  0.92  0.00,  -0.71  0.71  0.00,
                        -0.92  0.38  0.00,  -1.00  0.00  0.00,
                        -0.92 -0.38  0.00,  -0.71 -0.71  0.00,
                        -0.38 -0.92  0.00,   0.00 -1.00  0.00,
                         0.38 -0.92  0.00,   0.71 -0.71  0.00,
                         0.92 -0.38  0.00,
                    ]
                }
                coordIndex [
                    0,  1, -1,   0,  2, -1,
                    0,  3, -1,   0,  4, -1,
                    0,  5, -1,   0,  6, -1,
                    0,  7, -1,   0,  8, -1,
                    0,  9, -1,   0, 10, -1,
                    0, 11, -1,   0, 12, -1,
                    0, 13, -1,   0, 14, -1,
                    0, 15, -1,   0, 16, -1
                ]
                colorPerVertex TRUE
                color Color {
                    color [
                        1.0 1.0 0.0,  # burst center color
                        1.0 0.3 0.3   # burst ends color
                    ]
                }
                colorIndex [
                    0,  1,  0,   0,  1,  0,
                    0,  1,  0,   0,  1,  0,
                    0,  1,  0,   0,  1,  0,
                    0,  1,  0,   0,  1,  0,
                    0,  1,  0,   0,  1,  0,
                    0,  1,  0,   0,  1,  0,
                    0,  1,  0,   0,  1,  0,
                    0,  1,  0,   0,  1,  0,
                ]
            }
        },
        Transform { rotation 0.0 1.0 0.0  0.785 children USE Burst },
        Transform { rotation 0.0 1.0 0.0  1.57  children USE Burst },
        Transform { rotation 0.0 1.0 0.0  2.355 children USE Burst }
    ]
}